package com.njtoyo.taxi.admin.service.business.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.njtoyo.taxi.admin.mapper.master.entity.VersionUpdate;
import com.njtoyo.taxi.admin.mapper.master.mapper.VersionUpdateMapper;
import com.njtoyo.taxi.admin.rest.pojo.dto.VersionUpdateParamDTO;
import com.njtoyo.taxi.admin.service.business.VersionUpdateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VersionUpdateServiceImpl implements VersionUpdateService {

    @Resource
    private VersionUpdateMapper versionUpdateMapper;

    @Override
    public VersionUpdate queryInfo(VersionUpdateParamDTO dto) {
        QueryWrapper<VersionUpdate> queryWrapper = new QueryWrapper();
        queryWrapper.orderByDesc("id");
        List<VersionUpdate> versionUpdates = versionUpdateMapper.selectList(queryWrapper);
        if(CollectionUtils.isNotEmpty(versionUpdates)){
            VersionUpdate versionUpdate = versionUpdates.get(0);
            return versionUpdate;
        }
        return null;
    }
}
